Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Struct

Ptr<T>

struct Ptr<T> where T: struct, new()

Module: System.Runtime.InteropServices
Assembly: System.Runtime.dll
Source file: Ptr.rvn

Inheritance: Object → ValueType → Ptr<T>
Implements: EquatableTo<Ptr<T>>

A non-owning typed native pointer. Copying this value copies the address, not its storage. Native use requires an unsafe context and a live allocation with a compatible layout. The default value contains a null pointer. This type neither keeps storage alive nor frees it.

Address equality and lifetime

See the typed pointer contract for both equality operators, inherited value hashing, null behavior, constraints and ownership. RavenDoc currently gives the two operators a colliding detail-page filename; the linked manual reference documents both.

Constructors

1 item
Ptr(pointer: *T) Wraps an unmanaged pointer without copying memory or acquiring ownership. The caller remains responsible for the pointed-to storage and its matching release operation.

Properties

1 item
Pointer: *T Gets the underlying unmanaged pointer for an explicit native ABI boundary. Access through it must respect the allocation's bounds, alignment, initialization and lifetime.

Methods

5 items
Equals(other: Ptr<T>) -> bool Compares addresses without reading either allocation or changing its lifetime. Implements EquatableTo<Ptr<T>>.Equals
Equals(other: object?) -> bool Compares a boxed pointer of the same element type by address. Overrides Object.Equals
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString

Operators

2 items
Static member: operator ==(left: Ptr<T>, right: Ptr<T>) -> bool Tests whether two pointers of the same element type contain the same address.
Static member: operator !=(left: Ptr<T>, right: Ptr<T>) -> bool Tests whether two pointers of the same element type contain different addresses.